<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of NewsModel
 *
 * @author Константин Охотник
 */

namespace Jacov\JacovBundle\Model;

use Jacov\JacovBundle\Entity\News;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;

class NewsModel
{
    public function __construct($entityManager)
    {
        $this->entityManager = $entityManager;
    }
    
    public function getAllNews()
    {
        $this->Pages = new News();
        $query = $this->entityManager->createQuery(
            'SELECT news.id,news.title ,news.date, news.author, news.news
            FROM JacovJacovBundle:News news'
        );
        return $query->getResult();
    }
}
